#! /bin/sh

while [ 2 -le 3 ]
do
  date > /tmp/i3_periodic_status
  echo "Starting Periodic Update"  >> /tmp/i3_periodic_status
  #cd ~i3/dilip_i3server/i3_server_scripts 2>&1>>/tmp/i3_periodic_status
  rm -f i3_status.html i3_status.txt
  ./update_i3_server_web_status.pl -f i3_servers_planetlab/_i3news.conf -o i3_status -l planetlab_latitude_longitude.txt 2>&1>>/tmp/i3_periodic_status

  echo "Moving files to www directory\n" >> /tmp/i3_periodic_status
  cp -f i3_status.html /var/www/html/i3_status.html
  chown apache.i3 /var/www/html/i3_status.html
  cp -f i3_status.txt /var/www/html/i3_status.txt 
  chown apache.i3 /var/www/html/i3_status.txt
  echo "Done Periodic Update..sleeping"  >> /tmp/i3_periodic_status
  date >> /tmp/i3_periodic_status
  echo "--------------------------------" >> /tmp/i3_periodic_status 
  sleep 300;
  echo "Woken up from sleep" >> /tmp/i3_periodic_status
done;
